home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / python-support / python2.6 / rdflib / interfaces.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  11.4 KB  |  271 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4.  
  5. try:
  6.     from zope.interface import Interface, classImplements, implements
  7. except ImportError:
  8.     
  9.     class Interface(object):
  10.         pass
  11.  
  12.     
  13.     def classImplements(c, i):
  14.         pass
  15.  
  16.     
  17.     def implements(*args):
  18.         pass
  19.  
  20.  
  21. from rdflib import RDF
  22.  
  23. class IGraph(Interface):
  24.     '''    An rdflib.Graph indexes data expressed in the Resource Description
  25.     Framework (RDF).  Any kind of content, whether inside Zope or from
  26.     some outside source, can be cataloged if it can describe itself
  27.     using the RDF standard.  Any kind of RDF vocabulary like RSS, OWL,
  28.     DAML+OIL, Dublin Core, or any kind of XML schema or data can be
  29.     expressed into the graph.
  30.  
  31.     Once data is graphed it can be queried using either the Python
  32.     query interface, a TALES-based RDF query expression language, or
  33.     the sparql rdf query language.  Results of a query can be either a
  34.     generator of result records or RDF in xml or NT format.
  35.  
  36.     In Semantic Web terms, a graph is a persistent triple store.  RDF
  37.     is broken down into subject, predicate, and object relations
  38.     (called triples) and each relation is indexed.  The triple store
  39.     can then be queried for triples that match patterns.
  40.     '''
  41.     
  42.     def parse(rdf, format = 'xml'):
  43.         ''' Parse RDF-XML into the catalog. '''
  44.         pass
  45.  
  46.     
  47.     def add(.0):
  48.         ''' Add one triple to the catalog.  '''
  49.         (subject, predicate, object) = .0
  50.  
  51.     
  52.     def remove(.0):
  53.         ''' Remove one triple from the catalog. '''
  54.         (subject, predicate, object) = .0
  55.  
  56.     
  57.     def triples(.0, *args):
  58.         ''' Query the triple store. '''
  59.         (subject, predicate, object) = .0
  60.  
  61.     
  62.     def contexts(triple = None):
  63.         ''' Generator over all contexts in the graph. If triple is
  64.         specified, a generator over all contexts the triple is in.'''
  65.         pass
  66.  
  67.     
  68.     def value(subject, predicate = RDF.value, object = None, default = None, any = False):
  69.         """ Get a value for a subject/predicate, predicate/object, or
  70.         subject/object pair -- exactly one of subject, predicate,
  71.         object must be None. Useful if one knows that there may only
  72.         be one value.
  73.  
  74.         It is one of those situations that occur a lot, hence this
  75.         'macro' like utility
  76.  
  77.         Parameters:
  78.         -----------
  79.         subject, predicate, object  -- exactly one must be None
  80.         default -- value to be returned if no values found
  81.         any -- if True:
  82.                  return any value in the case there is more than one
  83.                else:
  84.                  raise UniquenessError
  85.         """
  86.         pass
  87.  
  88.     
  89.     def label(subject, default = ''):
  90.         ''' Queries for the RDFS.label of the subject, returns default
  91.         if no label exists.'''
  92.         pass
  93.  
  94.     
  95.     def comment(subject, default = ''):
  96.         ''' Queries for the RDFS.comment of the subject, returns
  97.         default if no comment exists.'''
  98.         pass
  99.  
  100.     
  101.     def items(list):
  102.         '''Generator over all items in the resource specified by list
  103.         (an RDF collection)'''
  104.         pass
  105.  
  106.     
  107.     def __iter__():
  108.         ''' Iterates over all triples in the store.'''
  109.         pass
  110.  
  111.     
  112.     def __contains__(triple):
  113.         """ Support for 'triple in graph' syntax."""
  114.         pass
  115.  
  116.     
  117.     def __len__(context = None):
  118.         ''' Returns the number of triples in the graph. If context is
  119.         specified then the number of triples in the context is
  120.         returned instead.'''
  121.         pass
  122.  
  123.     
  124.     def __eq__(other):
  125.         ''' Test if Graph is exactly equal to Graph other.'''
  126.         pass
  127.  
  128.     
  129.     def __iadd__(other):
  130.         ''' Add all triples in Graph other to Graph.'''
  131.         pass
  132.  
  133.     
  134.     def __isub__(other):
  135.         ''' Subtract all triples in Graph other from Graph.'''
  136.         pass
  137.  
  138.     
  139.     def subjects(predicate = None, object = None):
  140.         ''' A generator of subjects with the given predicate and
  141.         object.'''
  142.         pass
  143.  
  144.     
  145.     def predicates(subject = None, object = None):
  146.         ''' A generator of predicates with the given subject and
  147.         object.'''
  148.         pass
  149.  
  150.     
  151.     def objects(subject = None, predicate = None):
  152.         ''' A generator of objects with the given subject and
  153.         predicate.'''
  154.         pass
  155.  
  156.     
  157.     def subject_predicates(object = None):
  158.         ''' A generator of (subject, predicate) tuples for the given
  159.         object'''
  160.         pass
  161.  
  162.     
  163.     def subject_objects(predicate = None):
  164.         ''' A generator of (subject, object) tuples for the given
  165.         predicate'''
  166.         pass
  167.  
  168.     
  169.     def predicate_objects(subject = None):
  170.         ''' A generator of (predicate, object) tuples for the given
  171.         subject'''
  172.         pass
  173.  
  174.     
  175.     def get_context(identifier):
  176.         ''' Returns a Context graph for the given identifier, which
  177.         must be a URIRef or BNode.'''
  178.         pass
  179.  
  180.     
  181.     def remove_context(identifier):
  182.         ''' Removes the given context from the graph. '''
  183.         pass
  184.  
  185.     
  186.     def transitive_objects(subject, property, remember = None):
  187.         ''' '''
  188.         pass
  189.  
  190.     
  191.     def transitive_subjects(predicate, object, remember = None):
  192.         ''' '''
  193.         pass
  194.  
  195.     
  196.     def load(location, publicID = None, format = 'xml'):
  197.         ''' for b/w compat. See parse.'''
  198.         pass
  199.  
  200.     
  201.     def save(location, format = 'xml', base = None, encoding = None):
  202.         ''' for b/x compat. See serialize.'''
  203.         pass
  204.  
  205.     
  206.     def context_id(uri):
  207.         pass
  208.  
  209.     
  210.     def parse(source, publicID = None, format = 'xml'):
  211.         """ Parse source into Graph. If Graph is context-aware it'll
  212.         get loaded into it's own context (sub graph). Format defaults
  213.         to xml (AKA rdf/xml). The publicID argument is for specifying
  214.         the logical URI for the case that it's different from the
  215.         physical source URI. Returns the context into which the source
  216.         was parsed."""
  217.         pass
  218.  
  219.     
  220.     def serialize(destination = None, format = 'xml', base = None, encoding = None):
  221.         ''' Serialize the Graph to destination. If destination is None
  222.         serialize method returns the serialization as a string. Format
  223.         defaults to xml (AKA rdf/xml).'''
  224.         pass
  225.  
  226.     
  227.     def seq(subject):
  228.         '''
  229.         Check if subject is an rdf:Seq. If yes, it returns a Seq
  230.         class instance, None otherwise.
  231.         '''
  232.         pass
  233.  
  234.     
  235.     def absolutize(uri, defrag = 1):
  236.         """ Will turn uri into an absolute URI if it's not one already. """
  237.         pass
  238.  
  239.     
  240.     def bind(prefix, namespace, override = True):
  241.         '''Bind prefix to namespace. If override is True will bind
  242.         namespace to given prefix if namespace was already bound to a
  243.         different prefix.'''
  244.         pass
  245.  
  246.     
  247.     def namespaces():
  248.         '''Generator over all the prefix, namespace tuples.
  249.         '''
  250.         pass
  251.  
  252.  
  253.  
  254. class IIdentifier(Interface):
  255.     
  256.     def n3():
  257.         ''' Return N3 representation of identifier. '''
  258.         pass
  259.  
  260.     
  261.     def startswith(string):
  262.         ''' dummy. '''
  263.         pass
  264.  
  265.     
  266.     def __cmp__(other):
  267.         ''' dummy. '''
  268.         pass
  269.  
  270.  
  271.